<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="keywords" content="Java, API, ABI, changes, compatibility, analysis, checker" />
  <meta name="description" content="A tool for checking backward API/ABI compatibility of a Java library" />
  <title>Java API Compliance Checker</title>

  <style type="text/css">
    body {
      margin-top: 1.0em;
      background-color: #deeef7;
      font-family: Helvetica, Arial, FreeSans, san-serif;
      color: #000000;
    }
    #container {
      margin: 0 auto;
      width: 700px;
    }
    h1 { font-size: 3.8em; color: #211108; margin-bottom: 3px;margin-top:0px;padding-top:0px;}
    h1 .small { font-size: 0.4em; }
    h1 a { text-decoration: none }
    h2 { font-size: 1.5em; color: #211108; }
    h3 { text-align: center; color: #211108; }
    a { color: #211108; }
    .description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
    .download { float: right; }
    pre {padding: 0px;margin: 0px;padding-left: 10px;word-wrap:break-word;white-space: pre-wrap;}
    hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
    .footer { text-align:center; padding-top:30px; font-style: italic; }
    .code {border: dashed 1px gray; background-color: #f0f0f0;padding:5px;}
    .listing {padding: 10px;border: 1px solid black;width: 70%;font-family:"DejaVu Sans Mono", "Monaco", "Courier New", monospace;font-size:14px;}
    .summary {border:1px solid black;border-collapse:collapse;}
    table.summary td, table.summary th {border:1px solid black;padding:2px;}
  </style>

</head>

<body>
  <a href="https://github.com/lvc/japi-compliance-checker"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>

  <div id="container">

    <div class="download">
      <a href="https://github.com/lvc/japi-compliance-checker/zipball/master">
        <img style="border: 0;" width="90" src="https://github.com/images/modules/download/zip.png" alt="" /></a>
      <a href="https://github.com/lvc/japi-compliance-checker/tarball/master">
        <img style="border: 0;" width="90" src="https://github.com/images/modules/download/tar.png" alt="" /></a>
    </div>
   
    <h1>Java API Compliance Checker</h1>

    <div class="description">
      A tool for checking backward API/ABI compatibility of a Java library
    </div>

      <p/>
      Java API Compliance Checker (JAPICC) is a tool for checking backward binary and source-level compatibility of a Java library API. The tool checks classes declarations of old and new versions and analyzes changes that may break compatibility: removed methods, removed class fields, added abstract methods, etc. The HTML compatibility report generated by this tool includes separate sections for both source and binary compatibility analysis and exact error messages of the jvm and the compiler for each break found in the API.
      
      <p/>
      Binary incompatibility may result in crashing or incorrect behavior of existing clients built with an old version of a library when they are running with a new one. Source incompatibility may result in recompilation errors with a new library version. The tool is intended for developers of software libraries and Linux maintainers who are interested in ensuring backward compatibility, i.e. allow old clients to run or to be recompiled with newer library versions.
      
      <p/>
      The <b>Scala</b> language is supported since <b>1.7</b> version of the tool.
      
      <p/>
      The tool is a core of the <a href='https://abi-laboratory.pro/java/tracker/'>Java API Tracker</a> project.

<table class='summary'><tr><td>
<div>Table of Contents</div>
<ul>
<li><a href="#Downloads">Downloads</a></li>
<li><a href="#License">License</a></li>
<li><a href="#Supported_Platforms">Supported Platforms</a></li>
<li><a href="#Dependencies">Dependencies</a></li>
<li><a href="#Installation">Installation</a></li>
<li><a href="#Usage">Usage</a></li>
<li><a href="#Adv_Usage">Adv. Usage (Multiple Archives)</a></li>
<li><a href="#Examples">Examples</a></li>
<li><a href="#DetectableProblems">Detectable Compatibility Problems</a></li>
<li><a href="#TestSuite">Test Suite</a></li>
<li><a href="#API_Dump">API Dumps</a></li>
<li><a href="#Report">Report Format</a></li>
<li><a href="#Verdict">Verdict on Compatibility</a></li>
<li><a href="#Error">Error Codes</a></li>
<li><a href="#Similar">Similar Tools</a></li>
<li><a href="#Bugs">Bugs</a></li>
<li><a href="#Maintainers">Maintainers</a></li>
<li><a href="#ChangeLog">Changes</a></li>
<li><a href="#Articles">Articles</a></li>
</ul>
</td></tr></table>

<a name="Downloads"></a>
<h2>Downloads</h2>
<p>The latest release can be downloaded from <a href="https://github.com/lvc/japi-compliance-checker/releases">this page</a>.</p>

<p>Read-only access to the latest development version:</p>

<code class='code'>&nbsp;git clone https://github.com/lvc/japi-compliance-checker.git&nbsp;</code>

<a name="License"></a>
<h2>License</h2>
<p>This program is free software. You may use, redistribute and/or modify it under the terms of the <a href="http://www.gnu.org/licenses/">GNU GPL</a> or <a href="http://www.gnu.org/licenses/">GNU LGPL</a></p>

<a name="Supported_Platforms"></a>
<h2>Supported Platforms</h2>
GNU/Linux, FreeBSD, Mac OS X, MS Windows.
    
<a name="Dependencies"></a>
<h2>Dependencies</h2>
<ul>
<li>
  JDK or OpenJDK - development files (javap, javac)
</li>
<li>
  Perl 5
</li>
</ul>

<a name="Installation"></a>
<h2>Installation</h2>
<p>The tool is <b>ready-to-use</b> after extracting the archive.</p>

<p>You can also use a Makefile to install the tool into the system:</p>
<code class='code'>&nbsp;cd japi-compliance-checker-x.y.z/&nbsp;</code>
<p>
<code class='code'>&nbsp;sudo make install prefix=PREFIX [/usr, /usr/local, ...]&nbsp;</code>
</p>
<p>This command will install the <code>japi-compliance-checker</code> program into the <code>PREFIX/bin</code> system directory and private modules into the <code>PREFIX/share</code>.</p>

<p>To verify that the tool is installed correctly and it works on your host run:</p>
<code class='code'>&nbsp;cd tmp/&nbsp;</code>
<p>
<code class='code'>&nbsp;japi-compliance-checker -test&nbsp;</code>
</p>

<a name="Usage"></a>
<h2>Usage</h2>
Use the following command to compare two Java archives:
<p/>
<code class='code'>&nbsp;japi-compliance-checker -lib NAME V1.jar V2.jar&nbsp;</code>
<p/>
The compatibility report will be generated to:
<p/>
<code class='code'>&nbsp;compat_reports/NAME/V1_to_V2/compat_report.html&nbsp;</code>
<p/>

<a name="Adv_Usage"></a>
<h2>Usage (Multiple Archives)</h2>
To compare different versions of a library that consists of many JARs you should create <a href='./Xml-Descriptor.html'>XML descriptors</a> for two library versions: v1.xml and v2.xml files. Library descriptor is a simple XML-file that specifies version number, paths to Java archives and other optional information. An example of the descriptor is the following:
<p/>
<div class='listing'>
<pre>
<span style='color:Green'>&lt;version&gt;</span>
    1.0
<span style='color:Green'>&lt;/version&gt;</span>

<span style='color:Green'>&lt;archives&gt;</span>
    /path1/to/JAR(s)/
    /path2/to/JAR(s)/
       ...
<span style='color:Green'>&lt;/archives&gt;</span>
</pre>
</div>
<p/>

Command to compare two versions of a library:
<p/>
<code class='code'>japi-compliance-checker -lib NAME -old V1.xml -new V2.xml</code>
<p/>
The compatibility report will be generated to:
<p/>
<code class='code'>compat_reports/NAME/V1_to_V2/compat_report.html</code>
<p/>

<a name="Examples"></a>
<h2>Examples</h2>
<table class='summary'>
<tr><th>Library</th><th>Versions</th><th>Report</th></tr>
<tr>
<td>Guava</td>
<td>18.0 vs 19.0</td>
<td><a href='http://abi-laboratory.pro/java/tracker/compat_report/guava/18.0/19.0/6b5ea/bin_compat_report.html'>report</a></td>
</tr>
<tr>
<td>SLF4J</td>
<td>1.5.11 vs 1.6.0</td>
<td><a href='http://abi-laboratory.pro/java/tracker/compat_report/slf4j/1.5.11/1.6.0/c87de/bin_compat_report.html'>report</a></td>
</tr>
<tr>
<td>ICU4J</td>
<td>56_1 vs 57_1</td>
<td><a href='http://abi-laboratory.pro/java/tracker/compat_report/icu4j/56_1/57_1/09121/src_compat_report.html'>report</a></td>
</tr>
</table>
<p/>
See more report examples at <a href='https://abi-laboratory.pro/java/tracker/'>https://abi-laboratory.pro/java/tracker/</a>. 

<a name="DetectableProblems"></a>
<h2>Detectable Compatibility Problems</h2>
The tool searches for the following list of changes in the API that may break binary/source-level compatibility. See <a href='http://wiki.eclipse.org/Evolving_Java-based_APIs_2'>“Evolving Java-based APIs: Achieving API Binary Compatibility”</a> for more info.

<ul>
<li>

<b>Problems with Data Types</b>
<ul>
    <li>
    Classes and Interfaces
        <ul>
            <li>
                removed classes or interfaces
            </li>
            <li>
                removed fields
            </li>
            <li>
                removed methods
            </li>
            <li>
                change of a field type
            </li>
            <li>
                change of a field access level
            </li>
            <li>
                change of a field attributes (final, static, etc.)
            </li>
            <li>
                change of a constant field value
            </li>
            <li>
                changes in fields (recursive analysis)
            </li>
            <li>
                added/removed abstract methods
            </li>
            <li>
                added/removed super-interfaces
            </li>
        </ul>
    </li>
    <li>
    Classes
        <ul>
            <li>
                added/removed super-classes
            </li>
            <li>
                moving a method up class hierarchy
            </li>
            <li>
                overridden methods
                <br/>
                <br/>
            </li>
        </ul>
    </li>
</ul>

</li>
<li>

<b>Problems with Methods</b>
<ul>
    <li>
        changed attributes (static, final, synchronized, abstract, etc.)
    </li>
    <li>
        changed access level
    </li>
    <li>
        added/removed exceptions
        <br/>
        <br/>
    </li>
</ul>

</li>
<li>
<b>Problems with Annotations</b>
<ul>
<li>
    removed annotations
</li>
</ul>

</li>
</ul>
<p/>

<a name="TestSuite"></a>
<h2>Test Suite</h2>
The tool is tested properly in the <a href='https://abi-laboratory.pro/java/tracker/'>Java API Tracker</a> project, by the community and by the internal test suite:
<p/>
<code class='code'>japi-compliance-checker -test</code>
<p/>
There are about 80 basic tests in the test suite.

<a name="API_Dump"></a>
<h2>API Dumps</h2>
The API dump is a dump of the API model used in the tool. You can create API dump by the <code>-dump</code> option and use it instead of the Java archive.
<p/>
The API dump consists of:

<ul>

<li>
    <b>Types Information</b>
    <ul>
        <li>
            Attributes (name, package, access, base types, etc.)
        </li>
        <li>
            Fields (name, type, access, specifiers, etc.)
        </li>
        <li>
            Etc. 
        </li>
    </ul>
</li>

<li>
    <b>Symbols Information</b>
    <ul>
        <li>
            Attributes (name, mangled name, package, access, specifiers, etc.)
        </li>
        <li>
            Parameters (name, type, position, etc.)
        </li>
        <li>
            Etc.
        </li>
    </ul>
</li>

<li>
    Etc.
</li>

</ul>

<p/>
To create an API dump use <code>-dump</code> option:
<p/>
<code class='code'>japi-compliance-checker -lib NAME -dump LIB.jar -dump-path ./API.dump</code>
<p/>
To compare API dumps pass them instead Java archives:
<p/>
<code class='code'>japi-compliance-checker -lib NAME -old API-0.dump -new API-1.dump</code>

<a name="Report"></a>
<h2>Report Format</h2>
The HTML-format compatibility report consists of:

<ul>
    <li>
        <b>Test Info</b> - The library name and compared version numbers.
    </li>
    <li>
        <b>Test Results</b> - Verdict on compatibility. Number of archives, classes and methods checked by the tool.
    </li>
    <li>
        <b>Problem Summary</b> - Classification of compatibility problems.
    </li>
    <li>
        <b>Added Methods</b> - The list of added methods.
    </li>
    <li>
        <b>Removed Methods</b> - The list of removed methods.
    </li>
    <li>
        <b>Problems with Data Types</b> - List of compatibility problems caused by changes in data types (divided by the severity level: High, Medium, Low). List of affected methods.
    </li>
    <li>
        <b>Problems with Methods</b> - The list of compatibility problems caused by changes in method parameters and attributes (divided by the severity level).
    </li>
    <li>
        <b>Other Changes in Data Types</b> - The list of compatible changes in data types.
    </li>
    <li>
        <b>Other Changes in Methods</b> - The list of compatible changes in methods.
    </li>
</ul>

<a name="Verdict"></a>
<h2>Verdict on Compatibility</h2>
If the tool detected problems with high or medium level of severity or at least one removed method then the compatibility verdict is <b>incompatible</b> (otherwise <b>compatible</b>). Low-severity problems can be considered as <b>warnings</b> and don't affect the compatibility verdict unless the <code>-strict</code> option is specified.

<a name="Error"></a>
<h2>Error Codes</h2>
<table class='summary'>
<tr><th>Code</th><th>Meaning</th></tr>
<tr><td>0</td><td>Compatible. The tool has run without any errors.</td></tr>
<tr><td>1</td><td>Incompatible. The tool has run without any errors.</td></tr>
<tr><td>2</td><td>Common error code (undifferentiated).</td></tr>
<tr><td>3</td><td>A system command is not found.</td></tr>
<tr><td>4</td><td>Cannot access input files.</td></tr>
<tr><td>7</td><td>Invalid input API dump.</td></tr>
<tr><td>8</td><td>Unsupported version of input API dump.</td></tr>
<tr><td>9</td><td>Cannot find a module.</td></tr>
</table>

<a name="Similar"></a>
<h2>Similar Tools </h2>
<ul>
    <li>
         <b>Clirr</b> - checks Java libraries for binary and source compatibility with older releases
    </li>
    <li>
         <b>Revapi</b> - API analysis and change tracking tool
    </li>
    <li>
         <b>Japicmp</b> - a tool to compare two versions of a jar archive
    </li>
    <li>
         <b>Japitools</b> - test for compatibility between Java APIs
    </li>
    <li>
         <b>Jour</b> -  Java API compatibility testing tools
    </li>
    <li>
         <b>Japi-checker</b> - a java API backward compatibility checker which works at binary level
    </li>
    <li>
         <b>SigTest</b> -  Oracle's SigTest signature testing and API conformance tool
    </li>
</ul>

<a name="Bugs"></a>
<h2>Bugs</h2>
Please post bug reports, feature requests and questions to the <a href="https://github.com/lvc/japi-compliance-checker/issues">issue tracker</a>.
<p/>

<a name="Maintainers"></a>
<h2>Maintainers</h2>
The tool is developed by <a href="https://abi-laboratory.pro/">Andrey Ponomarenko</a>.

<a name="ChangeLog"></a>
<h2>Changes</h2>
You can find changelog <a href='Changelog.html'>here</a>.

<a name="Articles"></a>
<h2>Articles</h2>

<ul>
    <li>
        <a href='http://wiki.eclipse.org/Evolving_Java-based_APIs_2'>“Evolving Java-based APIs: Achieving API Binary Compatibility”</a>, Jim des Rivières 
    </li>
    <li>
        <a href='http://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html'>“Binary Compatibility”</a>, Java Language Specification
    </li>
    <li>
        <a href='https://blogs.oracle.com/darcy/entry/kinds_of_compatibility'> “Kinds of Compatibility: Source, Binary, and Behavioral”</a>, Joseph D. Darcy's Oracle Weblog 
    </li>
</ul>

<div class="footer">
    get the source code on GitHub : <a href="https://github.com/lvc/japi-compliance-checker">lvc/japi-compliance-checker</a>
</div>

<br/>
<br/>

</div>
</body>
</html>
